import Vue from "vue";
import VueRouter from 'vue-router';
// import Home from '../components/Home.vue'

Vue.use(VueRouter)

export default new VueRouter({
    mode: 'history',
    routes: [//这边不要写成routers了！！！
        {
            path: '/',
            redirect: '/login',
            hidden:true,
            component: () => import('@/components/Login')
        },
        {
            path: '/login',
            name: 'Login',
            hidden:true,
            component: () => import('@/components/Login')
        },
        {
            path: '*',
            name: 'NotFound',
            hidden:true,
            component: () => import('@/components/NotFound')
        },
        // {
        //     path: '/home',
        //     // component: Home,
        //     component: () => import('@/components/Home')   //路由懒加载
        //     // component: resolve => require(['@/components/Home'],resolve)     //异步组件写法
        // }
        {
            path: '/home',
            name: '学生管理',
            iconClass: 'fa fa-users',
            redirect:'/home/student',
            component: () => import('@/components/Home'),
            children: [
                {
                    path: 'student',
                    name: '学生列表',
                    iconClass: 'fa fa-list',
                    component: () => import('@/components/students/StudentList')
                },
                {
                    path: 'info',
                    name: '信息列表',
                    iconClass: 'fa fa-list-alt',
                    component: () => import('@/components/students/InfoList')
                },
                {
                    path: 'infos',
                    name: '信息管理',
                    iconClass: 'fa fa-list-alt',
                    component: () => import('@/components/students/InfoLists')
                },
                {
                    path: 'work',
                    name: '作业列表',
                    iconClass: 'fa fa-list-ul',
                    component: () => import('@/components/students/WorkList')
                },
                {
                    path: 'works',
                    name: '作业管理',
                    iconClass: 'fa fa-th-list',
                    component: () => import('@/components/students/WorkMent')
                },
            ]
        },
        {
            path:'/user',
            name:'用户中心',
            iconClass:'fa fa-user',
            component:()=>import('@/components/users/User')
        }
    ]
})